<?php 
/**
 * Html code of search box witch is visible on almost every page.
 * 
 * @package templates
 */

	$info = SiteContext::getSiteContext();
	$random = Common::createFormHash();
	$info->setFormHash($random);
	$cm = CodeManager::getCodeManager();
	
	HtmlHelper::setValuesToInit($_GET);
?>
<form style="height: 33px;" id="search" action="/index.php" method="get" enctype="multipart/form-data">
<div class="left">	
	<?php echo $cm->get("30061"); ?>: <input type="text" <?php echo HtmlHelper::inputValueWithAttr(Constants::SEARCH_FULLTEXT); ?>/>

	<!-- <input type="text" value="<?php echo $random; ?>" class="invisible" name="formHash" />-->
	<input type="text" value="<?php echo Constants::REQ_ACTION_SEARCH; ?>" class="invisible" name="<?php echo Constants::REQ_ACTION; ?>" />
	<a id="searchClickSimple" style="visibility: hidden; position: absolute;" href="javascript:Search.advanced();"><?php echo $cm->get("30051"); ?></a>
</div>
<div class="left">	
	<div id="searchAdvanced"> <!-- Locality -->
		<div class="frame locality">
<?php
	
	foreach (Definitions::$SETUP_LOCALITIES as $localityId => $localityName) {
		echo '<div class="checkbox"><input class="checkbox" type="checkbox" '
			. HtmlHelper::selectedInputCheckboxWithAttr($localityId)
			. '/>'
			. $localityName
			. '</div>';
	}
?>
			<div class="cleaner"><!--  --></div>
		</div>
		
		
		<div  class="left frame area"> <!-- Area -->
			<?php echo $cm->get("30016"); ?>:&nbsp;&nbsp;&nbsp;
			<?php echo $cm->get("30018"); ?><input class="small" type="text" onblur="Common.makeInt(this);" <?php echo HtmlHelper::inputValueWithAttr(Constants::SEARCH_AREABOTTOM); ?>/>
			<?php echo $cm->get("30019"); ?><input class="small" type="text" onblur="Common.makeInt(this);" <?php echo HtmlHelper::inputValueWithAttr(Constants::SEARCH_AREATOP); ?>/>
		</div>
		<div class="left frame price"> <!-- Price -->
			<?php echo $cm->get("30017"); ?>:&nbsp;&nbsp;&nbsp;
			<?php echo $cm->get("30018"); ?><input class="small" type="text" onblur="Common.makeInt(this);" <?php echo HtmlHelper::inputValueWithAttr(Constants::SEARCH_PRICEBOTTOM); ?>/>
			<?php echo $cm->get("30019"); ?><input class="small" type="text" onblur="Common.makeInt(this);" <?php echo HtmlHelper::inputValueWithAttr(Constants::SEARCH_PRICETOP); ?>/>
		</div>
		<div class="cleaner"><!--  --></div>
		<div class="left frame area" style="height: 33px;"> <!-- Rent or Sale -->
			<?php echo $cm->get("30086"); ?>:&nbsp;&nbsp;&nbsp;
			<?php echo $cm->get("30084"); ?><input class="radio" type="radio" <?php echo HtmlHelper::inputRadioValueWithAttr(Constants::SEARCH_RENTORSALE, Constants::SEARCH_RENTORSALE_SALE); ?>"/>
			<?php echo $cm->get("30085"); ?><input class="radio" type="radio" <?php echo HtmlHelper::inputRadioValueWithAttr(Constants::SEARCH_RENTORSALE, Constants::SEARCH_RENTORSALE_RENT); ?>"/>
		</div>
		<div class="cleaner"><!--  --></div>
	</div>
	
	
	<input class="submit middle" type="submit" value="<?php echo $cm->get("20005"); ?>" />
	<input class="clear middle" type="button" onclick="Common.clearForm(this.form)" value="<?php echo $cm->get("20007"); ?>" />
	<a id="searchClickAdvanced" href="javascript:Search.advanced();"><?php echo $cm->get("30050"); ?></a>
	<?php 
	foreach(array_merge(array(Constants::SEARCH_AREABOTTOM => true, Constants::SEARCH_RENTORSALE => true,
			Constants::SEARCH_AREATOP => true, Constants::SEARCH_PRICEBOTTOM => true, Constants::SEARCH_PRICETOP => true), 
			Definitions::$SETUP_LOCALITIES) as $index => $value) {
				if (@isset($_GET[$index]) && $_GET[$index] != "") {
					?>
					<script type="text/javascript">
						onLoad.add(function() {
							if (Search.isNotInitialized) {
								onLoad.add(Search.advanced);
							} else {
								Search.advanced();
							}
						});
					</script>
					<?php 
					break;
				}
			}
	?>
</div>
<div class="cleaner"><!--  --></div>
</form>
<?php if (@$_GET[Constants::REQ_ACTION] == Constants::REQ_ACTION_SEARCH) {?>
<div class="text"> <h2><?php echo $cm->get("30062"); ?></h2></div>
<?php } ?>